package cn.iocoder.yudao.module.system.controller.admin.mini.userInfo.vip;

import cn.iocoder.yudao.module.system.controller.admin.mini.goodInfo.discount.DiscountDO;
import cn.iocoder.yudao.module.system.controller.admin.mini.goodInfo.discount.mapper.DiscountMapper;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.math.BigDecimal;

@Service
public class VipServiceImpl implements VipService{

    @Resource
    DiscountMapper discountMapper;

    //0.99
    @Override
    public BigDecimal getDiscount() {
        BigDecimal discount = discountMapper.selectOne(new LambdaQueryWrapper<DiscountDO>().eq(DiscountDO::getName, "会员")).getDiscount();
        return new BigDecimal("100").subtract(discount).multiply(new BigDecimal("0.01"));
    }
}
